package week7th;

import java.util.Scanner;

public class inToSuTest {
    public static void main(String[] args) {

        String expression;
        Scanner in = new Scanner(System.in);
        int result;


        PostfixEvaluator evaluator = new PostfixEvaluator();
        System.out.println("Enter a valid post-fix expression one token " +
                "at a time with a space between each token (e.g. 1 + 2 * 3 - 4)");
        System.out.println("Each token must be an integer or an operator (+,-,*,/)");
        infixToSuffix itf = new infixToSuffix();
        expression = itf.toSuffix(in.nextLine());

        result = evaluator.evaluate(expression);

        System.out.println("That expression equals " + result);
        System.out.println();
        System.out.println("The Expression Tree for that expression is: ");
        System.out.println(evaluator.getTree());

    }
}
